import { HTTPMethod, type DataArrResponse, type UniHttpRequestRecord } from "./http";
import type { User, UserProfile } from "./user";

// 主机
const HOST = "http://117.72.55.151";
// 端口
const PORT = 32222;

export interface ApiDefinition {
    BASE:string;
    USER_LOGIN:UniHttpRequestRecord<string>,
    USER_CREATE:UniHttpRequestRecord<string>,
    USER_QUERY:UniHttpRequestRecord<DataArrResponse<User>>,
    USER_QUERY_USER_PROFIEL:UniHttpRequestRecord<DataArrResponse<UserProfile>>,
    USER_QUERY_SELF_PROFILE:UniHttpRequestRecord<UserProfile>,
    USER_DELETE:UniHttpRequestRecord<string>,
    USER_MODIFY_USER_PASS:UniHttpRequestRecord<string>,
    USER_MODIFY_SELF_PASS:UniHttpRequestRecord<string>,
    USER_MODIFY_USER_PROFILE:UniHttpRequestRecord<string>,
    USER_MODIFY_SELF_PROFILE:UniHttpRequestRecord<string>,
    USER_VERIFY_LOGIN:UniHttpRequestRecord<string>
}

// API定义
export const API:ApiDefinition = {
    BASE:`${HOST}:${PORT}`,
    USER_LOGIN:{
        URL:"/User:Login",
        Method:HTTPMethod.POST,
        IsAuth:false
    },
    USER_CREATE:{
        URL:"/User:Create",
        Method:HTTPMethod.POST,
        IsAuth:false
    },
    USER_QUERY:{
        URL:"/User:Query",
        Method:HTTPMethod.POST,
        IsAuth:true
    },
    USER_QUERY_SELF_PROFILE:{
        URL:"/User:QuerySelfProfile",
        Method:HTTPMethod.GET,
        IsAuth:true
    },
    USER_QUERY_USER_PROFIEL:{
        URL:"/User:QueryProfile",
        Method:HTTPMethod.POST,
        IsAuth:true
    },
    USER_DELETE:{
        URL:"/User:Delete",
        Method:HTTPMethod.POST,
        IsAuth:true
    },
    USER_MODIFY_SELF_PASS:{
        URL:"/User:ModifyUserPass",
        Method:HTTPMethod.POST,
        IsAuth:true
    },
    USER_MODIFY_USER_PASS:{
        URL:"/User:ModifySelfPass",
        Method:HTTPMethod.POST,
        IsAuth:true
    },
    USER_MODIFY_SELF_PROFILE:{
        URL:"/User:ModifySelfProfile",
        Method:HTTPMethod.POST,
        IsAuth:true
    },
    USER_MODIFY_USER_PROFILE:{
        URL:"/User:ModifyProfile",
        Method:HTTPMethod.POST,
        IsAuth:true
    },
    USER_VERIFY_LOGIN:{
        URL:"/User:VerifyLogin",
        Method:HTTPMethod.POST,
        IsAuth:true
    }
    
}

